<?php
namespace Home\Controller;

use Think\Controller;

class AuthorController extends BaseController
{
    /**
     * 员工列表页
     *
     */
    public function index()
    {
        //职位显示
        $category_list = D("Author")->table("dsk_book_author_category")->order(array('sort_order' => "desc", 'id' => "asc"))->select();
        $cat_id = I("get.cat_id", 0);
        $_wheresql = "";
        if (!empty($cat_id)) {
            $_wheresql = "cat_id = $cat_id";
        }
        $cat_info = array();
        if (!empty($cat_id)) {
            $cat_info = D("Author")->table("dsk_book_author_category")->where("id = $cat_id")->find();
        }
        $author_list = D("Author")->table("dsk_book_author")->where($_wheresql)->order(array('sort_order' => "desc", 'id' => "asc"))->select();
        $data = array(
            "author_list" => $author_list,
            "category_list" => $category_list,
            "cat_id" => $cat_id,
            "cat_info" => $cat_info,
            "menu" => "author",
        );
        $this->assign($data);
        $this->display();
    }

}